home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / test / locale / ilocale.c < prev   
C/C++ Source or Header  |  1993-03-10  |  1KB  |  57 lines

  1.  
  2. /*
  3.  * ILOCALE.C
  4.  *
  5.  * Internationalization auto-load, brought in by DCC for commercial DICE
  6.  */
  7.  
  8. #include <exec/types.h>
  9. #include <clib/locale_protos.h>
  10. #include <stdio.h>
  11.  
  12. extern long _AutoLocale[];
  13. extern struct Library *LocaleBase;
  14.  
  15. static APTR Catalog;
  16.  
  17. __autoexit static void
  18. ILocaleExit(void)
  19. {
  20.     if (Catalog) {
  21.     CloseCatalog(Catalog);
  22.     Catalog = NULL;
  23.     }
  24. }
  25.  
  26. int
  27. SetCatalog(char *localeName, char *catName)
  28. {
  29.     int r = -1;
  30.  
  31.     struct TagItem tags[3] = {
  32.     OC_Language, localeName,
  33.     OC_BuiltInLanguage, "none",
  34.     TAG_DONE, NULL
  35.     };
  36.     if (localeName == NULL)
  37.     tags[0].ti_Tag = TAG_IGNORE;
  38.  
  39.     ILocaleExit();
  40.     if (LocaleBase) {
  41.     if (Catalog = OpenCatalogA(NULL, catName, tags)) {
  42.         long *al;
  43.  
  44.         r = 0;
  45.  
  46.         for (al = _AutoLocale + 1; *al; al += 2) {
  47.         /* printf("%s ->", (char *)*al); */
  48.         printf("GetCat: %d %08lx\n", al[1], GetCatalogStr(Catalog, al[1], NULL));
  49.         *al = GetCatalogStr(Catalog, al[1], (char *)al[0]);
  50.         /* printf("%s\n", (char *)*al); */
  51.         }
  52.     }
  53.     }
  54.     return(r);
  55. }
  56.  
  57.